From da155bb731639043abe99ac3b0c1dc32012dc87e Mon Sep 17 00:00:00 2001 From: Hans Breuer Date: Sat, 28 Jul 2001 23:02:02 +0000 Subject: [PATCH] build in the backend dir after auto-generating files 2001-07-29 Hans Breuer * gdk/makefile.msc : build in the backend dir after auto-generating files * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement with code from win32-production-branch. * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag before calling DestroyWindow, which indirectly calls gdk_window_destroy_notify () (performance patch merged from win32-production-branch) * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, R2_COPYPEN rop). It is claimed to be much faster. --- ChangeLog | 17 +++++++++++ ChangeLog.pre-2-0 | 17 +++++++++++ ChangeLog.pre-2-10 | 17 +++++++++++ ChangeLog.pre-2-2 | 17 +++++++++++ ChangeLog.pre-2-4 | 17 +++++++++++ ChangeLog.pre-2-6 | 17 +++++++++++ ChangeLog.pre-2-8 | 17 +++++++++++ gdk/makefile.msc | 6 ++++ gdk/win32/gdkdrawable-win32.c | 55 ++++++++++++++++++++++++++++++----- gdk/win32/gdkfont-win32.c | 28 ++++++++++++++++++ gdk/win32/gdkwindow-win32.c | 5 +++- 11 files changed, 204 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b2a58fddf8..e8f8700636 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +2001-07-29 Hans Breuer + + * gdk/makefile.msc : build in the backend dir after + auto-generating files + + * gdk/win32/gdkfont-win32.c (gdk_font_load) : reimplement + with code from win32-production-branch. + + * gdk/win32/gdkwindow-win32.c : set the private->destroyed flag + before calling DestroyWindow, which indirectly calls + gdk_window_destroy_notify () + + (performance patch merged from win32-production-branch) + * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_segments): + Use PatBlt() instead of LineTo() when possible (solid single-pixel pen, + R2_COPYPEN rop). It is claimed to be much faster. + Fri Jul 27 11:31:15 2001 Jonathan Blandford * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_property): diff --git a/gdk/makefile.msc b/gdk/makefile.msc index 7866cd2455..dd6c377fc6 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -45,11 +45,17 @@ CFLAGS = -I . -I .. $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I ../gdk-pixbuf \ EXTRALIBS = $(WTKIT)\lib\i386\wntab32x.lib $(GLIB_LIBS) \ ..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib $(PANGOWIN32_LIBS) +gdk-win32-backend : + cd win32 + nmake -nologo -f makefile.msc + cd .. + all: \ ..\config.h \ gdkconfig.h \ gdkenumtypes.h \ gdkenumtypes.c \ + gdk-win32-backend \ gdk-win32-$(GTK_VER).dll \ testgdk.exe diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 2554ec365d..8910965fdd 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -867,17 +867,56 @@ gdk_win32_draw_segments (GdkDrawable *drawable, } else { + const gboolean maybe_patblt = + gc_private->rop2 == R2_COPYPEN && + gc_private->pen_width <= 1 && + (gc_private->pen_style & PS_STYLE_MASK) == PS_SOLID; + for (i = 0; ok && i < nsegs; i++) { - if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) - WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE; - if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2)) - WIN32_GDI_FAILED ("LineTo"), ok = FALSE; + /* PatBlt() is much faster than LineTo(), says + * jpe@archaeopteryx.com. Hmm. Use it if we have a solid + * colour pen, then we know that the brush is also solid and + * of the same colour. + */ + if (maybe_patblt && segs[i].x1 == segs[i].x2) + { + int y1, y2; + + if (segs[i].y1 <= segs[i].y2) + y1 = segs[i].y1, y2 = segs[i].y2; + else + y1 = segs[i].y2, y2 = segs[i].y1; + + if (!PatBlt (hdc, segs[i].x1, y1, + 1, y2 - y1 + 1, PATCOPY)) + WIN32_GDI_FAILED ("PatBlt"), ok = FALSE; + } + else if (maybe_patblt && segs[i].y1 == segs[i].y2) + { + int x1, x2; + + if (segs[i].x1 <= segs[i].x2) + x1 = segs[i].x1, x2 = segs[i].x2; + else + x1 = segs[i].x2, x2 = segs[i].x1; + + if (!PatBlt (hdc, x1, segs[i].y1, + x2 - x1 + 1, 1, PATCOPY)) + WIN32_GDI_FAILED ("PatBlt"), ok = FALSE; + } + else + { + if (!MoveToEx (hdc, segs[i].x1, segs[i].y1, NULL)) + WIN32_GDI_FAILED ("MoveToEx"), ok = FALSE; + if (ok && !LineTo (hdc, segs[i].x2, segs[i].y2)) + WIN32_GDI_FAILED ("LineTo"), ok = FALSE; - /* Draw end pixel */ - if (ok && gc_private->pen_width <= 1) - if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) - WIN32_GDI_FAILED ("LineTo"), ok = FALSE; + /* Draw end pixel */ + if (ok && gc_private->pen_width <= 1) + if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2)) + WIN32_GDI_FAILED ("LineTo"), ok = FALSE; + } } } gdk_win32_hdc_release (drawable, gc, mask); diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c index 69c893f022..30f3388593 100644 --- a/gdk/win32/gdkfont-win32.c +++ b/gdk/win32/gdkfont-win32.c @@ -1517,6 +1517,11 @@ GdkFont* gdk_font_load (const gchar *font_name) { GdkFont *font; + GdkFontPrivateWin32 *private; + GdkWin32SingleFont *singlefont; + HGDIOBJ oldfont; + HANDLE *f; + TEXTMETRIC textmetric; g_return_val_if_fail (font_name != NULL, NULL); @@ -1524,6 +1529,29 @@ gdk_font_load (const gchar *font_name) if (font) return font; + private = g_new (GdkFontPrivateWin32, 1); + font = (GdkFont*) private; + + singlefont = gdk_font_load_internal (font_name); + + private->base.ref_count = 1; + private->names = NULL; + private->fonts = g_slist_append (NULL, singlefont); + + /* Pretend all fonts are fontsets... Gtktext and gtkentry work better + * that way, they use wide chars, which is necessary for non-ASCII + * chars to work. (Yes, even Latin-1, as we use Unicode internally.) + */ + font->type = GDK_FONT_FONTSET; + oldfont = SelectObject (gdk_display_hdc, singlefont->hfont); + GetTextMetrics (gdk_display_hdc, &textmetric); + SelectObject (gdk_display_hdc, oldfont); + font->ascent = textmetric.tmAscent; + font->descent = textmetric.tmDescent; + + GDK_NOTE (MISC, g_print ("... asc %d desc %d\n", + font->ascent, font->descent)); + gdk_font_hash_insert (GDK_FONT_FONTSET, font, font_name); return gdk_font_from_one_singlefont (gdk_font_load_internal (font_name)); diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index c6205b8350..afa5e86a7b 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -770,7 +770,10 @@ _gdk_windowing_window_destroy (GdkWindow *window, } } else if (!recursing && !foreign_destroy) - DestroyWindow (GDK_WINDOW_HWND (window)); + { + private->destroyed = TRUE; + DestroyWindow (GDK_WINDOW_HWND (window)); + } } /* This function is called when the window really gone. -- 2.30.2